package com.example.blogdesign.Controller;


import com.example.blogdesign.Entity.BlogComments;
import com.example.blogdesign.Service.IBlogCommentsService;
import com.example.blogdesign.dto.Result;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;


@RestController
@RequestMapping("/blogComments")
public class BlogCommentsController {

    @Resource
    private IBlogCommentsService blogCommentsService;

    @PostMapping("/add")
    public Result<?> addBlogComments(@RequestBody BlogComments blogComments){
        return blogCommentsService.addBlogComments(blogComments);
    }

    @GetMapping("/queryFirst")
    public Result<List<BlogComments>> queryBlogFirstComments(@RequestParam("blogId") Long blogId){
        return blogCommentsService.queryBlogFirstComments(blogId);
    }


    @GetMapping("/answerComments")
    public Result<List<BlogComments>> queryAnswerComments(@RequestParam("blogCommentId") Long blogCommentId){
        return blogCommentsService.queryAnswerComments(blogCommentId);
    }

}
